<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/static/bootstrap-5.1.3-dist/css/bootstrap.css">
    <script type="text/javascript" src="/static/bootstrap-5.1.3-dist/js/bootstrap.js"></script>
    <title>回复</title>
</head>
<style>
    .back {
        position: absolute;
        font-size: 26px;
        top: 30px;
        left: 40px;
        text-decoration: none;
        color: #000;
        font-weight: bold;
    }

    .back:hover {
        color: #000;
    }

    h2 {
        text-align: center;
        margin-top: 15px;
    }

    .card {
        width: 1400px;
        height: 700px;
        background-color: #fffdfd;
        border-radius: 30px;
        border: none;
        box-shadow: 5px 5px 10px #adabab;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        margin: auto;
    }

    .mod {
        padding: 30px 300px;
    }


    .remark-item .nierong {
        width: 600px;
        background-color: #e3ddde;
        display: block;

    }


    .page {
        height: 50px;
        /*width: 1270px;*/
        /*margin-left: 1400px;*/
        position: fixed;
        bottom: 300px;
        right: 500px;
    }

    .reply{

        position: fixed;
        bottom: 70px;
    }
    .reply textarea{
        width: 800px;
    }

</style>
<body>
<a href="${pageContext.request.contextPath}/commentList?pid=${post.id}" class="back">
    <span><</span>返回</a>
<h2>回复</h2>
<div class="card mod">
    <div class="title">
        <div class="mb-3 row">
            <label for="staticTitle" class="col-sm-2 col-form-label">帖子主题</label>
            <div class="col-sm-10">
                <input type="text" readonly class="form-control-plaintext" id="staticTitle" value="${post.title}">
            </div>
        </div>
<%--        帖子主题：${post.title}<br>--%>
    </div>
    <div class="content">
        <div class="mb-3 row">
            <label for="staticContent" class="col-sm-2 col-form-label">评论内容</label>
            <div class="col-sm-10">
                <input type="text" readonly class="form-control-plaintext" id="staticContent" value="${remark.content}">
            </div>
        </div>
<%--        评论内容：${remark.content}--%>
    </div>
    <div class="remark">
        <div class="mb-3 row">
            <label class="col-sm-2 col-form-label">回复区</label>
            <div class="col-sm-10">
                <c:forEach items="${replyList}" var="reply" varStatus="s">
                    <c:forEach items="${userList}" var="ruser" varStatus="s1">
                        <c:if test="${ruser.id == reply.userid}">
                            <div class="remark-item">
                                <span>${ruser.username}:</span>
                                <span class="nierong">${reply.content}</span><br>
                            </div>

                        </c:if>
                    </c:forEach>
                </c:forEach>
            </div>
        </div>
<%--        <span>回复区：</span><br>--%>
        <div class="page">
            <c:if test="${pageInfo.isLast}">
                <span><a href="add_reply?page=${pageInfo.pageIndex-1}&rid=${remark.id}" class="btn-outline-secondary">上一页</a></span>
            </c:if>
            <c:if test="${pageInfo.isNext}">
                <span><a href="add_reply?page=${pageInfo.pageIndex+1}&rid=${remark.id}" class="btn-outline-secondary">下一页</a></span>
            </c:if>
            <br>
            <span>第 ${pageInfo.pageIndex} 页/共 ${pageInfo.sumCount} 页</span>
        </div>

    </div>
    <div class="reply">
        <form action="add_reply" method="post">
            <input type="hidden" name="remarkid" value="${remarkid}">
            <input type="hidden" name="pid" value="${post.id}">
<%--            <br style="clear:both"/>--%>
            <div class="mb-3 row">
                <label for="exampleFormControlTextarea1" class="form-label">评论</label>

                <textarea class="form-control" id="exampleFormControlTextarea1" rows="3" name="reply" placeholder="回复"></textarea>
            </div>
<%--            <textarea style="height:80px;width: 200px" name="reply" placeholder="回复"></textarea>--%>
            <div class="mb-3 btn">
                <input type="submit" name="submit" class="btn btn-primary" value="回复"/>
                <button type="reset" class="btn btn-outline-dark" style="margin-left: 40px">重置</button>
            </div>

        </form>
    </div>
</div>
</body>
</html>
